package com.huatai.saas.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.huatai.saas.dto.BackChunkDto;
import com.huatai.saas.entity.FileChunkEntity;
import com.huatai.saas.vo.CheckChunkVO;

import javax.servlet.http.HttpServletResponse;

/**
 * @BelongsProject: nanming-saas
 * @BelongsPackage: com.huatai.saas.service
 * @Author: hecaiy
 * @CreateTime: 2024-04-11  19:32
 * @Description: TODO
 * @Version: 1.0
 */
public interface FileChunkService extends IService<FileChunkEntity> {

	/**
	 * 文件分片上传
	 * @param chunk
	 * @param response
	 * @return
	 */
	int postFileUpload(BackChunkDto chunk, HttpServletResponse response);

	/**
	 * 文件分片上传至minio
	 * @param chunk
	 * @param response
	 * @return
	 */
	int postFileUploadMinio(BackChunkDto chunk, HttpServletResponse response);

	/**
	 * 检查文件上传状态
	 * @param chunk
	 * @param response
	 * @return
	 */
	CheckChunkVO getFileUpload(BackChunkDto chunk, HttpServletResponse response);

	/**
	 * minio分片文件合并
	 * @param chunk
	 * @throws Exception
	 */
	void merge(BackChunkDto chunk) throws Exception;

	/**
	 * 本地文件分片合并
	 * @param targetFile
	 * @param folder
	 * @param filename
	 * @throws Exception
	 */
	void merge(String targetFile, String folder, String filename) throws Exception;
}
